package com.itheima.controller;

import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.pojo.StudentOption;
import com.itheima.service.impl.ReportServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    //统计每个部门的人数
    @Autowired
    private ReportServiceImpl reportServiceimpl;

    @RequestMapping("/empJobData")
    public Result getReport() {
       JobOption jobOption = reportServiceimpl.getReport();
       return Result.success(jobOption);
    }

    //统计性别
    @RequestMapping("/empGenderData")
    public Result GetGenderData()
    {
       List<Map<String,Object>> list=reportServiceimpl.GetGenderData();
       return Result.success(list);
    }

    //统计学历
    @RequestMapping("/studentDegreeData")
    public Result GetStudentDegreeData()
    {
        List<Map<String,Object>> list=reportServiceimpl.GetStudentDegreeData();
        return Result.success(list);
    }

    //统计学生数量
    @RequestMapping("/studentCountData")
    public Result GetStudentCountData()
    {
        StudentOption studentOption = reportServiceimpl.GetStudentCountData();
        return Result.success(studentOption);
    }
}
